import request from '@/utils/request'

// 获取消息列表
export function getMessageList(params: any) {
  return request({
    url: '/system/message/list',
    method: 'get',
    params
  })
}

// 获取未读消息数量
export function getUnreadCount() {
  return request({
    url: '/system/message/unread/count',
    method: 'get'
  })
}

// 获取未读消息列表
export function getUnreadMessages() {
  return request({
    url: '/system/message/unread',
    method: 'get'
  })
}

// 标记消息已读
export function markMessageRead(messageId: string | number) {
  return request({
    url: `/system/message/read/${messageId}`,
    method: 'put'
  })
}

// 标记所有消息已读
export function markAllMessagesRead() {
  return request({
    url: '/system/message/read/all',
    method: 'put'
  })
}

// 删除消息
export function deleteMessage(messageId: string | number) {
  return request({
    url: `/system/message/${messageId}`,
    method: 'delete'
  })
}

// 清空所有消息
export function clearAllMessages() {
  return request({
    url: '/system/message/clear',
    method: 'delete'
  })
}